﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Format Tests</title>
		<link href="../Common/Styles/qunit.css" type="text/css" rel="stylesheet" />

		<script src="../Common/Scripts/JQuery/jquery-1.3.2.js" type="text/javascript"></script>
		<script src="../Common/Scripts/QUnit/qunit.js" type="text/javascript"></script>
		<script src="../Common/Scripts/Microsoft/MicrosoftAjax.debug.js" type="text/javascript"></script>
		<script src="../Common/Scripts/ExoWeb/exoweb.js" type="text/javascript"></script>
		<script src="../Common/Scripts/QUnit/qunit.ext.js" type="text/javascript"></script>
		<script src="../Common/Scripts/ExoWeb/exoweb.model.js" type="text/javascript"></script>
		<script type="text/javascript">
			test("Email", function () {
				var email = "test@site.com";
				var result = String.formats.Email.convertBack(email);
				equals(result, email, "Email format should pass");
				ok(!(result instanceof ExoWeb.Model.FormatError), "Should NOT be format error");

				var badEmail = "foo";
				var result = String.formats.Email.convertBack(badEmail);
				ok(result !== badEmail, "Email format should fail");
				ok(result instanceof ExoWeb.Model.FormatError, "Should be format error");
				equals(result.get_invalidValue(), badEmail, "Invalid value");
			});
		</script>
	</head>
	<body>
		<!-- QUnit Display -->
		<h1 id="qunit-header">Test Results:</h1>
		<h2 id="qunit-banner"></h2>
		<h2 id="qunit-userAgent"></h2>
		<ol id="qunit-tests"></ol>
	</body>
</html>
